<!--
 * @Author: coman
 * @LastEditors: coman
 * @Date: 2020-06-18 20:36:59
 * @motto: No pain,No gain
 * @LastEditTime: 2020-06-18 20:45:02
--> 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
       /*  检查一个字符串是否以指定的字符串结尾 */
       function findStrEnd(str,end){
        if(str.lastIndexOf(end)!==-1){
            return true;
        }else{
            return false;
        }
       }
       var str="abcder";
       var end="r";
       console.log(findStrEnd(str,end));
       
    </script>
</body>
</html>